< previous page page_252 next page >

Page 252
3. Add a ListView control to the form, and name it lvMain.
4. Add three ImageList controls to the form, and name them ilNormal, ilSmall, and ilHeader.
5. Add appropriate images to the ImageList controls. The sample code assumes that the ilNormal and ilSmall ImageLists contain only one image, and the ilHeader list contains three images.
Setting Properties of the ListView Control
As with most controls, you can set up the ListView control in two ways: by using the Properties window and Property Pages or by using code. If you want to set up the ListView while you are in the design environment, you can use the Property Pages, shown in Figure 12.5. For the sample project, you need to set four properties: View, Icons, SmallIcons, and ColumnHeaderIcons. You will learn how to set these properties at designtime, as well as examine sample code that does the job.
0252-01.jpg
Figure 12.5
Property Pages let you set the
properties of the ListView control.
First, you need to set the View property, which determines how the list presents information to the users. The View property has the following four possible values:
lvwIconDisplays each item in the list using a large icon and a simple text description.
lvwSmallIconDisplays each item in the list using a small icon and a simple text description. The items are ordered horizontally.
lvwListDisplays icons similarly to the small icon view, except that items are arranged in a single vertical column.
lvwReportDisplays each item with a small icon, a text description, and detailed information, if it is provided. As with the list view, items are arranged in vertical columns.
For the ListView control, you also need to set the names of the ImageList controls that contain the normal, small, and column heading icons that are shown in the list. If you are using the Property Pages, you can select the ImageList controls from drop-down lists on the Image Lists page. These lists contain the names of all the ImageList controls on your form. In the sample project, you set the View property from code.

 
< previous page page_252 next page >